﻿<%@ Page Language="C#" AutoEventWireup="false" Inherits="Web.BasePage"%>
<%@ Import Namespace="Web.Controller" %>
<%@ Import Namespace="Web" %>
<%@ Import Namespace="Web.UI" %>
<%@ Import Namespace="MAF.Common" %>
<fieldset>
    <legend>添加</legend>
    <form id="frmAddAritlce" method="post" action="Ajax.aspx?Module=<%=this.Module %>&Handler=Article&Action=Add">
    <dl>
        <dt>文章分类：</dt>
        <dd><select name="ParentId"><%=CategoryUI.Options(Guid.Empty) %></select></dd>
        
        <dt>文章标题：</dt>
        <dd><input type="text" name="Name" /></dd>
        
        <dt>文章内容：</dt>
        <dd><textarea name="Content" class="ckeditor"></textarea></dd>
        
        <dt>发布日期：</dt>
        <dd><input type="text" name="PublishedDate" value="<%=DateTime.Now.ToString() %>" /></dd>
        
        <dt></dt>
        <dd>
            <button>确定</button>
            <button class="cancel" onclick="return false;">取消</button>
        </dd>
        
        <dt>临时辅助工具：上传图片</dt>
        <dd>
            <span><input type="file" id="ajaxFile" name="file" /></span>
            <input type="button" id="ajaxButton" value="上传" />
            <input type="hidden" name="FilePath" />
            
            <span style="display:none" class="uploading">上传中...</span>
            <img src="#" style="display:none;width:100px;height:100px;" class="preview" />
        </dd>
    </dl>
    </form>
</fieldset>


<script type="text/javascript">

    (function ($) {

        var frm = $("#frmAddAritlce");
        var uploading = frm.find(".uploading");
        var preview = frm.find(".preview");
        var filepath = frm.find("input[name=FilePath]");
        var module = "<%=this.Module %>";
        
        jqAjaxUpload("#ajaxFile", "#ajaxButton", module
        , function () {
            uploading.show();
        }, function (resp) {
            uploading.hide();
            if (resp) {
                filepath.val(resp);
                preview.show().attr("src", "<%=WebConf.ImagesRootPath %>/" + module + "/" + resp);
            }
        });
    })(jQuery);
    
</script>